﻿using System.Data.OracleClient;
using picFilter.App_Code;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web.Http;

namespace picFilter.Controllers
{
    public class typeRemarksController : ApiController
    {
        // GET api/typeremarks        
        /// <summary>
        /// 获取所有证件类型评语关系
        /// </summary>
        /// <returns></returns>
        public object Get()
        {
            try
            {
                DataTable dt = DBHelper.ExecuteDataTable("Select * From typeRemark");
                return dt;
            }
            catch (Exception ex)
            {
                return new { error = "获取证件类型评语关系失败！", syserror = ex.Message };
            }
        }

        // GET api/typeremarks/5        
        /// <summary>
        /// 获取指定证件类型评语关系
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public object Get(int id)
        {
            try
            {
                OracleParameter remarkId = DBHelper.createParameter("remarkId", OracleType.Int32, id);
                DataTable dt = DBHelper.ExecuteDataTable("Select * From typeRemark Where id=:remarkId", remarkId);
                return dt;
            }
            catch(Exception ex)
            {
                return new { error = "获取证件类型评语关系失败！", syserror = ex.Message };
            }
            
        }
        

        // POST api/typeremarks
        public void Post([FromBody]string value)
        {
        }

        // PUT api/typeremarks/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/typeremarks/5
        public void Delete(int id)
        {
        }
    }
}
